using System.Collections.Generic;
using GameFramework;
using UnityEngine;

namespace StarForce
{
    public class GroundDataList : List<CreateGroundData>, IReference
    {
        public void Add(float location,int type,bool hasProp)
        {
            Add(ReferencePool.Acquire<CreateGroundData>().Fill(location,type,hasProp));
        }
        public new void Clear()
        {
            foreach (var item in this)
            {
                ReferencePool.Release((IReference) item);
            }

            base.Clear();
        }
    }


    /// <summary>
    /// 地板数据基类
    /// </summary>
    public class CreateGroundData : IReference
    {
        /// <summary>
        /// 地板生成位置
        /// </summary>
        private float m_GroundLocationX;
        /// <summary>
        /// 地板类型
        /// </summary>
        private int m_GroundType;

        /// <summary>
        /// 是否带有道具
        /// </summary>
        private bool m_HasProp;

        public bool HasProp
        {
            get { return m_HasProp; }
            set { m_HasProp = value; }
        }

        public float GroundLocation
        {
            get { return m_GroundLocationX; }
            set { m_GroundLocationX = value; }
        }

        public int GroundType
        {
            get { return m_GroundType; }
            set { m_GroundType = value; }
        }

        public CreateGroundData Fill(float groundLocation, int groundType,bool hasProp)
        {
            m_GroundLocationX = groundLocation;
            m_GroundType = groundType;
            m_HasProp = hasProp;
            return this;
        }

        public void Clear()
        {
            m_GroundLocationX = 0;
            m_GroundType = 0;
            m_HasProp = false;
        }
    }
}